function main() {

    var library_name = "libcocos2dlua.so" // ex: libsqlite.so
    var loaded = false
    Interceptor.attach(Module.findExportByName(null, 'android_dlopen_ext'),{
        onEnter: function(args){
            var library_path = Memory.readCString(args[0])
            console.log("found library : " + library_path)
            if( library_path.includes(library_name)){
                console.log("found library : " + library_path)
                loaded = true
            }
        },
        onLeave: function(args){
            if(loaded){
                if(false)
                {
                    var addr = Module.findExportByName(library_name ,"luaL_register")
                    console.log("luaL_register:"+addr)
                        Interceptor.attach(ptr(addr) , {
                        onEnter: function(args){
                            console.log("func addr-->"+args[1])
                            var content = Memory.readCString(ptr(args[1]))
                            console.log(content)
                        },
                        onLeave: function(retval){
                            }
                        })
                }
     
                loaded = false
            }
        }
    })
}
setImmediate(main);

// frida -U --no-pause -f com.hnzh.dldlwhjx.aligames -l c2ddldl
